package com.lemon.soft.bookingroom.configuration;

import com.lemon.soft.bookingroom.service.BookingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
public class TaskConfig {

    @Autowired
    private BookingsService bookingService;

    @Scheduled(fixedRate = 1800000) // 每30分钟执行一次（30 * 60 * 1000）
    public void checkBookingTimeoutTask() {
        bookingService.checkBookingTimeout();
    }
}